<?php 
    $display=12;
    if(isset($_GET['page'])&&(int)$_GET['page']){
        $page=$_GET['page'];
    }else{
        $mysql->query("SELECT* FROM sanpham where anhien='1'");
        $record=$mysql->num_row();
            if($record>$display){
                $page=ceil($record/$display);
            }
            else{
                $page=1;
            }
    }
    $start=(isset($_GET['start']) &&(int)$_GET['start']>0)? $_GET['start']: 0;
    $mysql->query("SELECT *
                FROM sanpham
                where kichhoat='1'
                and khuyenmai='1'
                ORDER BY id DESC
                LIMIT $start, $display");                 
?>